import Taro from "@tarojs/taro";

import taroRequest from "../config/taroRequest/taroRequest";
import config from './../config/domian'

const AllRequest = {
    describe(json) {
        let url = '/company/describe'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                data: json,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    //职位列表V1
    // job(json) {
    //     let url = '/worker/job'
    //     return new Promise((resolve, reject) => {
    //         taroRequest.request({
    //             url: url,
    //             method: 'POST',
    //             data: json
    //         }).then(res => {
    //             resolve(res)
    //         }).catch(err => {
    //             reject(err)
    //         })
    //     })
    // },
    //职位列表V2
    job(json) {
        let url = '/worker/jobList'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    industry() {
        let url = '/industry'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    area() {
        let url = '/area'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    star(json) {
        let url = '/worker/job/star'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    jobDetail(json) {
        let url = '/worker/job/show'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'GET',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    company(json) {
        let url = config[process.env.NODE_ENV].hostSaas + '/worker/company'
        return new Promise((resolve, reject) => {
            Taro.request({
                url: url,
                method: 'POST',
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    domain:config[process.env.NODE_ENV].domain
                },
                data: json
            }).then(res => {
                resolve(res.data)
            }).catch(err => {
                reject(err)
            })
        })
    },
    resumeShow() {
        let url = '/worker/show'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    showDemand() {
        let url = '/worker/showDemand'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    wokerMe() {
        let url = '/worker/me'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyMe() {
        let url = '/company/me'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    workerStarred(json) {
        let url = '/worker/job/starred'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    workerApplied(json) {
        let url = '/worker/job/applied'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    positionList() {
        let url = '/position'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    editDemand(json) {
        let url = '/worker/demand'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    editResume(json) {
        let url = '/worker/resume'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    license(json) {
        let url = '/company/company/license'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    showLicense() {
        let url = '/company/company/showLicense'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyResume(json) {
        let url = '/company/resume'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyResumeItem(json) {
        let url = '/company/resume/item'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    refuseResume(json) {
        let url = '/company/resume/refuse'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    callResume(json) {
        let url = '/company/resume/call'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyShow() {
        let url = '/company/company/show'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyJobList(json) {
        let url = '/company/job/list'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    editJob(json) {
        let url = '/company/job/describe'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyjobDetail(json) {
        let url = '/company/job/show'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    jobOffline(json) {
        let url = '/company/job/offline'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    tag() {
        let url = '/tag'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    jobApply(json) {
        let url = '/worker/job/apply'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    myCompany(json) {
        let url = '/company/company/list'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    workerWallet() {
        let url = '/worker/wallet'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    workerWalletLog() {
        let url = '/worker/wallet/log'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    buyResume(json) {
        let url = '/company/resume/buy'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    complaint(json) {
        let url = '/worker/job/complaint'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    resumeOrder() {
        let url = '/company/resume/order'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    walletLog(json) {
        let url = '/company/wallet/log'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    getSaas() {
        let url = '/index/resolveSaas'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'GET',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //企业端充值
    recharge(json) {
        let url = '/company/wallet/recharge/' + json
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'GET',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //formId获取
    collectionFormid(json) {
        let url = 'wechat/collection-form-id/' + json
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'GET',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    applyWithdraw() {
        let url = 'worker/apply-withdraw'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'GET',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //新建/编辑简历升级版
    resumev2(json) {
        let url = '/worker/resumev2'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //企业海报
    CompanyPoster(json) {
        let url = config[process.env.NODE_ENV].hostSaas + '/poster/companyPoster'
        return new Promise((resolve, reject) => {
            Taro.request({
                url: url,
                method: 'POST',
                data: json,
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    Authorization: Taro.getStorageSync('Authorization'),
                    domain:config[process.env.NODE_ENV].domain
                }
            }).then(res => {
                resolve(res.data)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //职位海报
    JobPoster(json) {
        let url = config[process.env.NODE_ENV].hostSaas + '/poster/JobPoster'
        return new Promise((resolve, reject) => {
            Taro.request({
                url: url,
                method: 'POST',
                data: json,
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    Authorization: Taro.getStorageSync('Authorization'),
                    domain:config[process.env.NODE_ENV].domain
                }
            }).then(res => {
                resolve(res.data)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //协议信息
    protocol(json) {
        let url = '/worker/protocol'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    resumePoolCategory() {
        let url = '/company/job/resumePoolCategory'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    resumePool(json) {
        let url = '/company/job/resumePool'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    workerStatus(json) {
        let url = '/worker/workerStatus'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    topInfo(json) {
        let url = '/company/job/topList'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    buyTopList(json) {
        let url = '/company/job/buyTopList'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //获取验证码
    verifyPhone(json) {
        let url = '/wap/user/verifyPhone'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    //套餐信息
    memberList(json) {
        let url = '/company/member/memberList'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    //购买会员
    buyMember(json) {
        let url = '/company/member/buyMember'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //购买会员加量包
    buyMemberMenu(json) {
        let url = '/company/member/buyMemberMenu'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
    indexTranmistPoster() {
        let url = config[process.env.NODE_ENV].hostSaas + '/poster/indexTranmistPoster'
        return new Promise((resolve, reject) => {
            Taro.request({
                url: url,
                method: 'POST',
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    domain:config[process.env.NODE_ENV].domain
                },
            }).then(res => {
                resolve(res.data)
            }).catch(err => {
                reject(err)
            })
        })
    },
    jobTranmistPoster(json) {
        let url = config[process.env.NODE_ENV].hostSaas + '/poster/jobTranmistPoster'
        return new Promise((resolve, reject) => {
            Taro.request({
                url: url,
                method: 'POST',
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    domain:config[process.env.NODE_ENV].domain
                },
                data:json
            }).then(res => {
                resolve(res.data)
            }).catch(err => {
                reject(err)
            })
        })
    },
    companyTranmistPoster(json) {
        let url = config[process.env.NODE_ENV].hostSaas + '/poster/companyTranmistPoster'
        return new Promise((resolve, reject) => {
            Taro.request({
                url: url,
                method: 'POST',
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    domain:config[process.env.NODE_ENV].domain
                },
                data:json
            }).then(res => {
                resolve(res.data)
            }).catch(err => {
                reject(err)
            })
        })
    },

    //专题数据
    topiceEntrance(json) {
        let url = '/worker/topiceEntrance'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    personInfo(json) {
        let url = '/worker/personInfo'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    customerConfig(json) {
        let url = '/worker/customerConfig'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    redBag(json) {
        let url = '/worker/redBag'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },

    getResumeRedBag(json) {
        let url = '/worker/getResumeRedBag'
        return new Promise((resolve, reject) => {
            taroRequest.request({
                url: url,
                method: 'POST',
                data: json
            }).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    },
}

export default AllRequest;

